package com.zouchao.module.module_project_main;

import android.test.ActivityInstrumentationTestCase2;

import com.robotium.solo.Solo;
import com.zouchao.module.module_project_main.activity.MainActivity;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

/**
 * Created by zouchao on 2017/12/9.
 */

public class HelloActivityTest extends ActivityInstrumentationTestCase2<MainActivity> {

    private Solo solo;
    private boolean tag = false;
    public HelloActivityTest() {
        super(MainActivity.class);
    }

    @Before
    public void setUp() throws Exception {
        super.setUp();
        solo = new Solo(getInstrumentation(), getActivity());
    }


    @Test
    public void testShowText() {
        Assert.assertTrue(solo.searchText("Hello word！"));
    }

    @Test
    public void testInputText() {
        if (tag) {
            for (int i = 0; i < 10; i++) {     //循环执行1条用例
                judgeText("This is EditTextActivity",1000);
                solo.clearEditText(0);  // 清空EditText表单 clearEditText(int index)
            }
        } else {
            judgeText("This is EditTextActivity",1000);
        }
    }

    private void judgeText( String text2, int time) {
//        solo.clickOnButton(getActivity().getString(R.string.iv_movie));
//        assertTrue("test",solo.searchEditText(text2));//判定结果
//        solo.sleep(time);
    }
}
